package com.cn.medicalcare.controller.servlet;

import com.cn.medicalcare.customtool.JsonTool;
import com.cn.medicalcare.customtool.SqlSessionFactoryTool;
import com.cn.medicalcare.mapper.ArticleContentMapper;
import com.cn.medicalcare.pojo.ArticleContent;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/getarticlecontent.json")
public class ArticleContentServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<ArticleContent> list= SqlSessionFactoryTool.DoMapper(ArticleContentMapper.class, m->m.selectArticle());
        resp.getWriter().print(JsonTool.toJson(list));
    }
}
